package com.zzb.text.service;

import com.zzb.text.dao.ParamsMapper;
import com.zzb.text.entity.Params;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by ZZB on 2017/6/16.
 */
@Service
public class ParamsService {
    @Autowired
    private ParamsMapper paramsMapper;

    public List<Params> list(){
        return paramsMapper.findAll();
    }

    public Params get(String id){
        return paramsMapper.getOne(id);
    }

    public void save(Params params){
        if(params.getId() == null || "".equals(params.getId())){
            paramsMapper.insert(params);
        } else {
            paramsMapper.update(params);
        }
    }

    public void delete(String id){
        paramsMapper.delete(id);
    }

}
